home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / RIncludes / Quickdraw.r < prev    next >
Encoding:
Text File  |  1998-08-21  |  13.8 KB  |  412 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        Quickdraw.r
  3.  
  4.      Contains:    Interface to Quickdraw Graphics
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18.  
  19. #ifndef __QUICKDRAW_R__
  20. #define __QUICKDRAW_R__
  21.  
  22. #ifndef __CONDITIONALMACROS_R__
  23. #include "ConditionalMacros.r"
  24. #endif
  25.  
  26. #ifndef OLDPIXMAPSTRUCT
  27. #if TARGET_OS_MAC
  28. #define OLDPIXMAPSTRUCT 1
  29. #else
  30. #define OLDPIXMAPSTRUCT 0
  31. #endif
  32. #endif
  33. #ifndef OLDGDEVICESTRUCT
  34. #if TARGET_OS_MAC
  35. #define OLDGDEVICESTRUCT 1
  36. #else
  37. #define OLDGDEVICESTRUCT 0
  38. #endif
  39. #endif
  40.  
  41. /*----------------------------acur • Cursor Pointers -----------------------------------*/
  42. type 'acur' {
  43.        integer = $$CountOf(CursIdArray); /* Nbr of cursors                 */
  44.        fill word;                        /* Next frame to show             */
  45.        array CursIdArray {
  46.            integer;                      /* 'CURS' resource id for a frame */
  47.            fill word;                    /* Pad word to make longint       */
  48.        };
  49. };
  50.  
  51.  
  52. /*---------------------------clut • Generic Color Lookup Table---------------------------*/
  53. /*
  54.     clut_RezTemplateVersion:
  55.         0 - original 
  56.         1 - implicit header, auto index value                 <-- default
  57. */
  58. #ifndef clut_RezTemplateVersion
  59.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  60.         #define clut_RezTemplateVersion 0
  61.     #else
  62.         #define clut_RezTemplateVersion 1
  63.     #endif
  64. #endif
  65.  
  66. type 'clut' {
  67.     #if clut_RezTemplateVersion == 0
  68.         unsigned hex longint;                                    /* ctSeed                */
  69.         integer;                                                /* ctFlags                */
  70.     #else
  71.         unsigned hex longint = 0;                                /* ctSeed                */
  72.         integer = 0;                                            /* ctFlags                */
  73.     #endif
  74.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  75.         wide array ColorSpec {
  76.     #if clut_RezTemplateVersion == 0
  77.                 integer;                                        /* value                */
  78.     #else
  79.                 integer = $$ArrayIndex(ColorSpec) - 1;            /* value                */
  80.     #endif
  81.                 unsigned integer;                                /* RGB:    red                */
  82.                 unsigned integer;                                /*        green            */
  83.                 unsigned integer;                                /*        blue            */
  84.         };
  85. };
  86.  
  87.  
  88. /*----------------------------------- common macros ---------------------------------------*/
  89.  
  90. #define    PixMapHeight    ( $$BitField(Bounds, 32, 16) /* bottom */            \
  91.                         - $$BitField(Bounds, 0, 16) /* top */ )
  92. #define    PixMapWidth        ( $$BitField(Bounds, 48, 16) /* right */            \
  93.                         - $$BitField(Bounds, 16, 16) /* left */ )
  94. #define    PixMapBounds    integer = $$BitField(Bounds, 0, 16) /* top */;        \
  95.                         integer = $$BitField(Bounds, 16, 16) /* left */;    \
  96.                         integer = $$BitField(Bounds, 32, 16) /* bottom */;    \
  97.                         integer = $$BitField(Bounds, 48, 16) /* right */
  98. #define    PixMapRowBytes    (((PixMapWidth * $$Word(PixelSize) + 15) / 16) * 2)
  99. #define    BitMapRowBytes    (((PixMapWidth + 15) / 16) * 2)
  100.  
  101. #define    PixMapHeightIndexed        ( $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 32, 16) /* bottom */            \
  102.                                 - $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 0, 16) /* top */ )
  103. #define    PixMapWidthIndexed        ( $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 48, 16) /* right */            \
  104.                                 - $$BitField(Bounds[$$ArrayIndex(PixPatArray)], 16, 16) /* left */ )
  105. #define    PixMapRowBytesIndexed    (((PixMapWidthIndexed * $$Word(PixelSize[$$ArrayIndex(PixPatArray)]) + 15) / 16) * 2)
  106.  
  107.  
  108. /* RGB colors */
  109. #define whiteRGB $FFFF, $FFFF, $FFFF
  110. #define blackRGB 0, 0, 0
  111.  
  112. /* colors for 'crsr' resources */
  113. #define transparentRGB $FFFF, $FFFF, $FFFF
  114. #define invertRGB 0, 0, 0
  115.  
  116.  
  117. /*------------------------crsr • old Color Cursor template----------------------------------*/
  118. /*
  119.     crsr_RezTemplateVersion:
  120.         0 - original 
  121.         1 - color plus simplified source format             <-- default
  122. */
  123. #ifndef crsr_RezTemplateVersion
  124.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  125.         #define crsr_RezTemplateVersion 0
  126.     #else
  127.         #define crsr_RezTemplateVersion 1
  128.     #endif
  129. #endif
  130.  
  131.  
  132. type 'crsr' {
  133.     #if crsr_RezTemplateVersion == 0
  134.         hex unsigned integer    oldCursor   = $8000,            /* Type of cursor        */
  135.                                 colorCursor = $8001;
  136.     #else
  137.         unsigned hex integer = $8001;                            /* Type of cursor        */
  138.     #endif        
  139.         unsigned longint = pixMap / 8;                            /* Offset to pixMap        */
  140.         unsigned longint = pixelData / 8;                        /* Offset to pixel data    */
  141.         fill long;                                                /* Expanded cursor data    */
  142.         fill word;                                                /* Expanded data depth    */
  143.         fill long;                                                /* Reserved                */
  144.         hex string [32];                                        /* One bit cursor data    */
  145.         hex string [32];                                        /* One bit cursor mask    */
  146.         point;                                                    /* Hot spot             */
  147.         fill long;                                                /* Table id                */
  148.         fill long;                                                /* id for cursor        */
  149.  
  150.         /* IconPMap (pixMap) record */
  151.     pixMap:
  152.         fill long;                                                /* Base address            */
  153.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  154.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  155.     #if    crsr_RezTemplateVersion == 0    
  156.         unsigned bitstring[13];                                    /* Offset to next row    */
  157.         rect;                                                    /* Bitmap bounds        */
  158.         integer;                                                /* pixMap version number*/
  159.         integer    unpacked;                                        /* Packing format        */
  160.         unsigned longint;                                        /* Size of pixel data    */
  161.         unsigned hex longint;                                    /* h. resolution (ppi) (fixed) */
  162.         unsigned hex longint;                                    /* v. resolution (ppi) (fixed) */
  163.         integer            chunky, chunkyPlanar, planar;            /* Pixel storage format    */
  164.         integer;                                                /* # bits in pixel        */
  165.         integer;                                                /* # components in pixel*/
  166.         integer;                                                /* # bits per field        */
  167.         unsigned longint;                                        /* Offset to next plane    */
  168.         unsigned longint = colorTable / 8;                        /* Offset to color table*/
  169.         fill long;                                                /* Reserved                */
  170.  
  171.     pixelData:
  172.         hex string [(colorTable - pixelData) / 8];                /* Pixel data            */
  173.     #else
  174.  
  175.  
  176.     pMapRowBytes:
  177.         unsigned bitstring[13] = PixMapRowBytes;                /* Offset to next row    */
  178.  
  179.     Bounds:    
  180.         rect = { 0, 0, 16, 16 };                                /* Bitmap bounds        */
  181.         integer = 0;                                            /* pixMap vers number    */
  182.         integer = 0;                                            /* Packing format        */
  183.         fill long;                                                /* Size of pixel data    */
  184.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  185.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  186.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  187.     PixelSize:
  188.         integer;                                                /* # bits in pixel        */
  189.         integer = 1;                                            /* # components in pixel*/
  190.         integer = $$Word(PixelSize);                            /* # bits per field        */
  191.         fill long;
  192.         unsigned longint = ColorTable / 8;
  193.         fill long;
  194.  
  195.     PixelData:
  196.         hex string [PixMapRowBytes * PixMapHeight];
  197.     #endif
  198.  
  199.         /* Color Table */
  200.     colorTable:
  201.         unsigned hex longint;                                    /* ctSeed                */
  202.         integer;                                                /* ctFlags                */
  203.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  204.         wide array ColorSpec {
  205.                 integer;                                        /* value                */
  206.                 unsigned integer;                                /* RGB:    red                */
  207.                 unsigned integer;                                /*        green            */
  208.                 unsigned integer;                                /*        blue            */
  209.         };
  210. };
  211.  
  212.  
  213. /*----------------------------CURS • Cursor---------------------------------------------*/
  214. type 'CURS' {
  215.         hex string [32];                                        /* Data                 */
  216.         hex string [32];                                        /* Mask                 */
  217.         point;                                                    /* Hot spot             */
  218. };
  219.  
  220.  
  221. /*----------------------------PAT  • Quickdraw Pattern----------------------------------*/
  222. type 'PAT ' {
  223.         hex string[8];                                            /* Pattern                */
  224. };
  225.  
  226.  
  227. /*----------------------------PAT# • Quickdraw Pattern List-----------------------------*/
  228. type 'PAT#' {
  229.         integer = $$Countof(PatArray);
  230.         array PatArray {
  231.                 hex string[8];                                    /* Pattern                */
  232.         };
  233. };
  234.  
  235.  
  236. /*----------------------------PICT • Quickdraw Picture----------------------------------*/
  237. #ifndef __PICT_R__
  238.     #ifndef PICT_RezTemplateVersion
  239.         #define PICT_RezTemplateVersion 0
  240.     #endif
  241.     #ifndef __PICTUTILS_R__
  242.         #include "PictUtils.r"
  243.     #endif
  244. #endif __PICT_R__
  245.  
  246.  
  247. /*------------------------ppat • Pixel Pattern old template---------------------------------*/
  248. /*
  249.     ppat_RezTemplateVersion:
  250.         0 - original 
  251.         1 - color plus simplified source format             <-- default
  252. */
  253. #ifndef ppat_RezTemplateVersion
  254.     #ifdef oldTemp                            /* grandfather in use of “oldTemp” */
  255.         #define ppat_RezTemplateVersion 0
  256.     #else
  257.         #define ppat_RezTemplateVersion 1
  258.     #endif
  259. #endif
  260.  
  261.  
  262. type 'ppat' {
  263.     #if ppat_RezTemplateVersion == 0 
  264.         /* PixPat record */
  265.         integer        oldPattern,                                    /* Pattern type            */
  266.                     newPattern,
  267.                     ditherPattern;
  268.     #else
  269.         integer = 1 /* newPattern */;                            /* Pattern type            */
  270.     #endif
  271.         unsigned longint = PixMap / 8;                            /* Offset to pixmap        */
  272.         unsigned longint = PixelData / 8;                        /* Offset to data        */
  273.         fill long;                                                /* Expanded pixel image    */
  274.         fill word;                                                /* Pattern valid flag    */
  275.         fill long;                                                /* expanded pattern        */
  276.         hex string [8];                                            /* old-style pattern    */
  277.  
  278.         /* PixMap record */
  279.     PixMap:
  280.         fill long;                                                /* Base address            */
  281.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  282.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  283.     #if ppat_RezTemplateVersion == 0 
  284.         unsigned bitstring[13];                                    /* Offset to next row    */
  285.         rect;                                                    /* Bitmap bounds        */
  286.         integer;                                                /* pixMap vers number    */
  287.         integer        unpacked;                                    /* Packing format        */
  288.         unsigned longint;                                        /* size of pixel data    */
  289.         unsigned hex longint;                                    /* h. resolution (ppi) (fixed) */
  290.         unsigned hex longint;                                    /* v. resolution (ppi) (fixed) */
  291.         integer            chunky, chunkyPlanar, planar;            /* Pixel storage format    */
  292.         integer;                                                /* # bits in pixel        */
  293.         integer;                                                /* # components in pixel*/
  294.         integer;                                                /* # bits per field        */
  295.         unsigned longint;                                        /* Offset to next plane    */
  296.         unsigned longint = ColorTable / 8;                        /* Offset to color table*/
  297.         fill long;                                                /* Reserved                */
  298.  
  299.     PixelData:
  300.         hex string [(ColorTable - PixelData) / 8];
  301.     #else
  302.  
  303.  
  304.     pMapRowBytes:
  305.         unsigned bitstring[13] = PixMapRowBytes;                /* Offset to next row    */
  306.     Bounds:    rect;                                                    /* Bitmap bounds        */
  307.         integer = 0;                                            /* pixMap vers number    */
  308.         integer = 0;                                            /* Packing format        */
  309.         fill long;                                                /* Size of pixel data    */
  310.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  311.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  312.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  313.     PixelSize:
  314.         integer;                                                /* # bits in pixel        */
  315.         integer = 1;                                            /* # components in pixel*/
  316.         integer = $$Word(PixelSize);                            /* # bits per field        */
  317.         fill long;
  318.         unsigned longint = ColorTable / 8;
  319.         fill long;
  320.  
  321.     PixelData:
  322.         hex string [PixMapRowBytes * PixMapHeight];
  323.     #endif
  324.     
  325.     ColorTable:
  326.         unsigned hex longint;                                    /* ctSeed                */
  327.         integer;                                                /* ctFlags                */
  328.         integer = $$Countof(ColorSpec) - 1;                        /* ctSize                */
  329.         wide array ColorSpec {
  330.     #if ppat_RezTemplateVersion == 0
  331.                 integer;                                        /* value                */
  332.     #else
  333.                 integer = $$ArrayIndex(ColorSpec) - 1;            /* value                */
  334.     #endif
  335.                 unsigned integer;                                /* RGB:    red                */
  336.                 unsigned integer;                                /*        green            */
  337.                 unsigned integer;                                /*        blue            */
  338.         };
  339. };
  340.  
  341.  
  342. /*----------------------------ppt# • list of pixpats;--------------------------------------*/
  343. type 'ppt#' {
  344.                                             /* PixPat offsets (calculate them some day!?!) */
  345.     integer = $$CountOf(OffsetArray);
  346.     array OffsetArray {                         /* [$$CountOf(PixPatArray)] */ 
  347.         unsigned longint                     /* = PixPat[$$ArrayIndex(OffsetArray)] / 8 */;
  348.     };
  349.  
  350.     array PixPatArray {
  351.     PixPat:
  352.         /* PixPat record */
  353.         integer = 1 /* newPattern */;                            /* Pattern type            */
  354.         unsigned longint = PixMap[$$ArrayIndex(PixPatArray)] / 8;    /* Offset to pixmap        */
  355.         unsigned longint = PixelData[$$ArrayIndex(PixPatArray)] / 8;    /* Offset to data        */
  356.         fill long;                                                /* Expanded pixel image    */
  357.         fill word;                                                /* Pattern valid flag    */
  358.         fill long;                                                /* expanded pattern        */
  359.         hex string [8];                                            /* old-style pattern    */
  360.     
  361.         /* PixMap record */
  362.     PixMap:
  363.         fill long;                                                /* Base address            */
  364.         unsigned bitstring[1] = 1;                                /* New pixMap flag        */
  365.         unsigned bitstring[2] = 0;                                /* Must be 0            */
  366.     pMapRowBytesIndexed:
  367.         unsigned bitstring[13] = PixMapRowBytesIndexed;            /* Offset to next row    */
  368.     Bounds:        
  369.         rect;                                                    /* Bitmap bounds        */
  370.         integer = 0;                                            /* pixMap vers number    */
  371.         integer = 0;                                            /* Packing format        */
  372.         fill long;                                                /* Size of pixel data    */
  373.         unsigned hex longint = $00480000;                        /* h. resolution (ppi)  */
  374.         unsigned hex longint = $00480000;                        /* v. resolution (ppi)  */
  375.         integer = 0 /* chunky */;                                /* Pixel storage format    */
  376.     PixelSize:
  377.         integer;                                                /* # bits in pixel        */
  378.         integer = 1;                                            /* # components in pixel*/
  379.         integer = $$Word(PixelSize[$$ArrayIndex(PixPatArray)]);    /* # bits per field        */
  380.         fill long;
  381.         unsigned longint = ColorTable[$$ArrayIndex(PixPatArray)] / 8;
  382.         fill long;
  383.     
  384.     PixelData:
  385.         hex string [PixMapRowBytesIndexed * PixMapHeightIndexed];
  386.  
  387.     
  388.     ColorTable:
  389.         unsigned hex longint = 0;                                /* ctSeed                */
  390.         integer = 0;                                            /* ctFlags                */
  391.         integer = $$Countof(ColorSpec[$$ArrayIndex(PixPatArray)]) - 1;    /* ctSize                */
  392.         wide array ColorSpec {
  393.                 integer = $$ArrayIndex(ColorSpec[$$ArrayIndex(PixPatArray)]) - 1;/* value                */
  394.                 unsigned integer;                                /* RGB:    red                */
  395.                 unsigned integer;                                /*        green            */
  396.                 unsigned integer;                                /*        blue            */
  397.         };
  398.     };
  399. };
  400.  
  401.  
  402. /*----------------------------mitq • Default queue sizes for MakeITable--------------------------------------*/
  403. type 'mitq' {                /* default MakeITable queue sizes */
  404.     wide array [3] {
  405.         unsigned longint;    /* queue size for 3, 4, and 5 bit inverse tables */
  406.     };
  407. };
  408.  
  409.  
  410. #endif /* __QUICKDRAW_R__ */
  411.  
  412.